<!-- 
All rights Reserved, Designed By www.youyacao.com 
@Description:卡密链接设置
@author:成都市一颗优雅草科技有限公司     
@version 松鼠聚合直播系统v2.0
注意：本前端源码遵循 MulanPSL-2.0开源协议（木兰宽松许可证）本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584

 -->


<template>
    <div>
        <van-nav-bar
                title="设置发卡链接"
                left-text="返回"
                left-arrow
                fixed
                @click-left="onClickLeft"
        />
        <div style="padding-top: 56px;">
            <van-cell-group>
                <van-field
                        v-model="links.month_card"
                        label="月卡购买"
                        placeholder="请输入购买链接"
                        type="text"
                />
                <van-field
                        v-model="links.ji_card"
                        label="季卡购买"
                        placeholder="请输入购买链接"
                        type="text"
                />
                <van-field
                        v-model="links.year_card"
                        label="年卡购买"
                        placeholder="请输入购买链接"
                        type="text"
                />
                <van-field
                        v-model="links.forever_card"
                        label="终身卡购买"
                        placeholder="请输入购买链接"
                        type="text"
                />
            </van-cell-group>
            <div style="padding: 30px 10px;"><van-button type="primary" size="large" style="height: 40px; line-height: 40px;" @click="doAlterPassword()">确认修改</van-button></div>
        </div>
    </div>
</template>

<script>
    import global_ from '../Global';
    import { Toast } from 'vant';
    import { Notify } from 'vant';
    export default {
        name: "password",
        data(){
            return {
                links:{
                    id:0,
                    month_card:"",
                    ji_card:"",
                    year_card:"",
                    forever_card:""
                }
            }
        },
        created(){
            this.$axios.get(global_.serverUrl+"admin/index/getlinks").then((res)=>{
                if(res.data){
                    this.links = res.data;
                }
            });
        },
        methods: {
            onClickLeft: function () {
                this.$router.go(-1);
            },
            doAlterPassword:function () {
                var toast = Toast.loading({
                    mask: true,
                    duration: 0,
                    message: '提交中...'
                });
                this.$axios.post(global_.serverUrl+"admin/index/savelink",{
                    id:this.links.id,
                    month_card:this.links.month_card,
                    ji_card:this.links.ji_card,
                    year_card:this.links.year_card,
                    forever_card:this.links.forever_card
                }).then((res)=>{
                    toast.clear();
                    if(res.code != 1){
                        Toast(res.msg);
                    }else{
                        Notify({ type: 'success', message: '链接修改成功' });
                    }
                }).catch(()=>{
                    toast.clear();
                });
            }
        }
    }
</script>

<style scoped>

</style>
